//
//  CSYUserMessageModel.swift
//  CSYMicroBlockSina
//
//  Created by 姚彦兆 on 15/11/14.
//  Copyright © 2015年 姚彦兆. All rights reserved.
//

import UIKit

class CSYUserMessageModel: NSObject {

    //设置模型属性
    var id : NSInteger = 0
    
    var name : String?
    
    //用户头像URL字符串
    var profile_image_url : String?
    
    //计算URL地址
    var iconURL : NSURL {
    
        return NSURL(string: profile_image_url ?? "")!
    
    }
    
    //用户微博等级
    var mbrank : NSInteger = 0
    
    //根据用户等级设置会员图标
    var rankImage : UIImage? {
    
        if mbrank > 0 && mbrank < 7 {
        
            return UIImage(named: "common_icon_membership_level\(mbrank)")!
        
        }else if mbrank == -1{
        
            return UIImage(named: "common_icon_membership_expired")!
        
        }
        
        return nil
    
    }
    
    //设置微博认证类型
    /**
    verified_type :::: -1 没有认证 || 0 认证用户 || 2,3,5 企业用户 || 220 达人
    */
    
    var verified_type : NSInteger = -1
    
    //设置认证图标
    
    var verified_image : UIImage? {
        
        switch verified_type{
        
        case 0 :    return UIImage(named: "avatar_vip")!
            
        case 2,3,5: return UIImage(named: "avatar_enterprise_vip")!
            
        case 220 :  return UIImage(named: "avatar_grassroot")!
            
        default :   return nil
            
        }
    
    }
    
    
    init(dict : [String : AnyObject]) {
        
        super.init()
        
        self.setValuesForKeysWithDictionary(dict)
        
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {}
    
}
